import request from '@/request/index.js';


// 跳转搜索页面
export function toSearchPage() {
	uni.navigateTo({
		url: '/page-repository/search/index'
	});
}


// 跳转详情内容页面
export function toParticularsPage(item) {
	let url = '/page-repository/repository-particulars/index';
	if (item.is_json == 1) {
		url = '/page-repository/repository-pull/index';
	}
	uni.navigateTo({
		url: url,
		success: function (e) {
			e.eventChannel.emit('sendData', { data: item });  // 通过eventChannel向被打开页面传送数据
		}
	});
}


// 搜索
export function getEncyclopediaSearch(data) {
	return request.post({
		url: '/his/app-api/encyclopedia/search',
		data: data || {},
		custom: {
			title: "健康百科-搜索",
			authentication: true
		}
	});
}


// 获取文章列表
export function getEncyclopediaArticleList(data) {
	return request.post({
		url: '/his/app-api/encyclopedia/articleList',
		data: data || {},
		custom: {
			title: "健康百科-文章列表",
			authentication: true
		}
	});
}


// 获取健康百科分类
export function getEncyclopediaCategory(pid) {
	return request.get({
		url: '/his/app-api/encyclopedia/category',
		params: {pid: pid},
		custom: {
			title: "健康百科-分类",
			authentication: true
		}
	});
}